package com.ruoyi.web.controller;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.AboutUsBanner;
import com.ruoyi.common.core.domain.entity.QueryId;
import com.ruoyi.system.service.IAboutUsBannerService;
import com.ruoyi.system.service.impl.AboutUsBannerServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author linxz
 * @since 2025-01-07
 */
@RestController
@RequestMapping("/aboutUsBanner")
public class AboutUsBannerController extends BaseController {
    @Autowired
    private IAboutUsBannerService service;

    @GetMapping("/list")
    public AjaxResult list(){
        return AjaxResult.success(service.getList());

    }
    @PostMapping("/add")
    public AjaxResult add(@RequestBody AboutUsBanner aboutUsBanner){
        return toAjax(service.add(aboutUsBanner));
    }

    @PostMapping("/update")
    public AjaxResult update(@RequestBody AboutUsBanner aboutUsBanner){
        return toAjax(service.update(aboutUsBanner));
    }

    @PostMapping("/delete")
    public AjaxResult delete(@RequestBody AboutUsBanner aboutUsBanner){
        return toAjax(service.delete(aboutUsBanner.getId()));
    }
    @GetMapping("/sectionList")
    public AjaxResult getSectionList(){
        return AjaxResult.success(service.getSectionList());
    }

    @PostMapping("/getBannerIdList")
    public AjaxResult getBannerIdList(@RequestBody QueryId queryId){
        return AjaxResult.success(service.getBannerIdList(queryId.getSectionName()));
    }


}
